﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace mForum.Domain.Specification
{
    using mForum.Core.Specification;
    using mForum.Domain.DomainObject;

    public class UserOnlineUsersSpecification : Specification<User>
    {
        private DateTime _onlineTime;

        public UserOnlineUsersSpecification()
        {
           
        }

        public override Expression<Func<User, bool>> SatisfiedBy()
        {
            _onlineTime = DateTime.Now.AddMinutes(-5);

            return x => x.LastActivityDate >= _onlineTime;
        }
    }
}
